import request from '@/utils/request'

// 查询NovelRole列表
export function listRole(query) {
  return request({
    url: '/novel/role/list',
    method: 'get',
    params: query
  })
}

// 查询NovelRole详细
export function getRole(id) {
  return request({
    url: '/novel/role/' + id,
    method: 'get'
  })
}

// 新增NovelRole
export function addRole(data) {
  return request({
    url: '/novel/role',
    method: 'post',
    data: data
  })
}

// 修改NovelRole
export function updateRole(data) {
  return request({
    url: '/novel/role',
    method: 'put',
    data: data
  })
}

// 删除NovelRole
export function delRole(id) {
  return request({
    url: '/novel/role/' + id,
    method: 'delete'
  })
}

// 优化角色提示词
export function optimizeRolePrompt(data) {
  return request({
    url: '/API/gen/optimize-role-prompt',
    method: 'post',
    data: data,
    timeout: 0  // 不设置超时
  })
}

// 生成图片
export function generateRoleImage(modelId, prompt) {
  return request({
    url: '/API/gen/image',
    method: 'post',
    data: {
      modelId: modelId,
      prompt: prompt
    },
    timeout: 0  // 不设置超时
  })
}

// 根据参考图片生成图片
export function generateRoleImageWithReference(modelId, prompt, image, image2, image3) {
  const data = {
    modelId: modelId,
    prompt: prompt
  }
  if (image) data.image = image
  if (image2) data.image2 = image2
  if (image3) data.image3 = image3

  return request({
    url: '/API/gen/image-with-reference',
    method: 'post',
    data: data,
    timeout: 0  // 不设置超时
  })
}
